<script>
    var $ = layui.jquery;
    $.ajaxSetup({
        headers: {
            "ajax": "yes"
        },
        xhrFields: {
            withCredentials: false
        },
        complete: function(xhr) {
            if(xhr.status == 401){
                parent.location.href = '/login';
            }
        }
    });
</script>